<template>
    <div class="container">
        <system-nav name="党员详情" :showBack="true"></system-nav>
        <div class="inner">
            <ul class="system-detail">
                <li>
                    <div>
                        <label>姓名</label>
                        <span>{{ member.empName }}</span>
                    </div>
                    <div>
                        <label>性别</label>
                        <span>{{ member.sex | formatSex }}</span>
                    </div>
                </li>
                <li>
                    <div>
                        <label>年龄</label>
                        <span>{{ member.age }}</span>
                    </div>
                    <div>
                        <label>身份证号</label>
                        <span>{{ member.idCard }}</span>
                    </div>
                </li>
                <li>
                    <div>
                        <label>手机号</label>
                        <span>{{ member.mobile }}</span>
                    </div>
                    <div>
                        <label>邮箱</label>
                        <span>{{ member.email }}</span>
                    </div> 
                </li>
                <li>
                    <div>
                        <label>工作时间</label>
                        <span>{{ member.workTime | formatDate('YYYY-MM-DD') }}</span>
                    </div>
                    <div>
                        <label>入党时间</label>
                        <span>{{ member.partyTime | formatDate('YYYY-MM-DD') }}</span>
                    </div>
                </li>
                <li>
                    <div>
                        <label>所属党组织</label>
                        <span>{{ member.deptName }}</span>
                    </div> 
                    <div>
                        <label>籍贯</label>
                        <span>{{ member.nativePlace }}</span>
                    </div>
                </li>
                <li>
                    <div>
                        <label>户口所在地</label>
                        <span>{{ member.registeredPlace }}</span>
                    </div>
                    <div>
                        <label>家庭地址</label>
                        <span>{{ member.address }}</span>
                    </div>
                </li>
            </ul>
            <Button class="btn-back" type="primary" @click="goBack" ghost>返回</Button>
        </div>
    </div>
</template>

<script>
import SystemNav from '@/components/SystemNav'
import mixin from '@/mixins'
import { getMemberRest } from '@/common/apis/system'

export default {
    name: 'memberDetail',
    mixins: [mixin],
    components: {
        SystemNav
    },
    data() {
        return {
            member: {
                empName: '',
                sex: 1,
                age: 18,
                deptName: '',
                workTime: '',
                partyTime: '',
                nativePlace: '',
                registeredPlace: '',
                address: '',
                idCard: '',
                mobile: '',
                email: ''
            }
        }
    },
    mounted() {
        this.id = this.$route.params.id
        this.initData()
    },
    methods: {
        initData() {
            getMemberRest(this.id).then(result => {
                this.member = result.data.content
            })
        }
    }
}
</script>
